<template>
  <div>
    <!--搜索查询-->
    <el-row>
      <!-- <el-col :span="">&nbsp;</el-col> -->
      <el-col :span="4"
        ></el-col>
      <el-col :span="2"
        ></el-col
      >
      <el-col :span="2"
        ></el-col
      >
      <el-col :span="2"
        ><el-button
          type="primary"
          size="mini"
          @click="flush()"
          icon="el-icon-refresh"
          >刷新</el-button
        ></el-col
      >
    </el-row>

    <el-row>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column
          prop="mobile"
          label="用户电话"
          align="center"
          width="120"
        >
        </el-table-column>
        <el-table-column
          prop="addressName"
          label="收件人"
          align="center"
          width="120"
        >
        </el-table-column>
        <el-table-column
          prop="phone"
          label="收件人号码"
          align="center"
          width="120"
        >
        </el-table-column>
        <el-table-column
          prop="province"
          label="省份"
          :formatter="typeFormat"
          align="center"
          width="120"
        >
        </el-table-column>
        <el-table-column
          prop="city"
          label="城市"
          :formatter="typeFormat"
          align="center"
          width="120"
        >
        </el-table-column>
        <el-table-column
          prop="district"
          label="区县"
          align="center"
          width="120"
        >
        </el-table-column>
        <el-table-column
          prop="detail"
          label="详细地址"
          align="center"
          width="100"
        >
        </el-table-column>
        
      </el-table>
    </el-row>
    <el-row>
      <!--分页插件-->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[2, 3, 5, 10, 20]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </el-row>

  
  </div>
</template>

<script>
export default {
  data() {
    return {
      title: "",
      imgUrl: "",
      condition: false,
      data: [], //权限树数组对象
      defaultProps: {
        //父对象传值
        children: "children",
        label: "label",
      },
      nodeChecked: [], //勾选项目数组对象
      tableData: [],
      currentPage: 1, //页码 第几页
      pageSize: 5, //每页显示数量
      total: 100, //总条数
      searchForm: {  addressId: "", }, //搜索form表单
      dialogFormVisible: false, //是否显示对话框  默认是不显示
      form: {}, //form表单对象
      roleId: 0, // 角色ID
      onlineStatus: "上线", //上下操作按钮
    };
  },
  created() {
    //初始化方法 类似于jquery  $({})
    this.loadData();
  },
  //所有函数
  methods: {
    //加载数据
    loadData() {
      var _this = this;
      //复制 $http官网代码
      // var token  = localStorage.getItem("token");
      this.$http
        .post("/address/queryPage", {
          pageNo: this.currentPage,
          pageSize: this.pageSize,
          data: { addressId: this.searchForm.addressId },
        })
        .then(function (response) {
          if (response.data.code == 200) {
            _this.tableData = response.data.data.records;
            _this.total = response.data.data.total;
          }
        })
        .catch(function (error) {
          console.log(error);
          _this.$message.error("你错了。。。");
        });
    },
  
 
  
    //处理每页数量发生变化
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      //让每页数量发生变化
      this.pageSize = val;
      //重载数据
      this.loadData();
    },
    //处理当前页变化
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      //让每页数量发生变化
      this.currentPage = val;
      //重载数据
      this.loadData();
    },
  
    //刷新
    flush() {
      this.currentPage = 1;
      this.pageSize = 5;
      this.loadData();
    },
  },
};
</script>
<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 178px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}

.pic {
  width: 178px;
  height: 178px;
  display: block;
}
</style>